<?php
	session_start();
	
	//validate user logged in; if not, redirect to login
	if(!isset($_SESSION['employee_id'])){
		header("location:login.php");
	}
	
	include "controller/php/Forms.php";
	
	if(!isset($_GET['form_id']))
	{
		header("location:home.php?error=1");
	}
	else {
		//get the form id
		$form_id = $_GET['form_id'];

		//render the corresponding form; bail if not passed
		switch ($form_id) {
			case 0 :
				$form = new TimeSheet;
				break;
			default :
				header("location:home.php?error=1");
		}
	}
?>

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="view/css/application.css" />
		<script type="text/javascript" src="view/javascript/application.js" ></script>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
		<script type="text/javascript" src="view/javascript/form_population.js"></script>
	</head>
	<body> 
		<div id="test"></div>
		<div id="content">
			<?php
			include "controller/php/navigation.php";
				
			echo renderNavigation();
			?>
		
			<div id="form">
				
				<?php 
				
				//render the form (will succeed; page redirected if no form id sent)
				$form->Render();
				
				?>
			
			</div>
		</div>
	</body>
</html>